package com.ssm.comm.session;


import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

/**
 *  redis存储的Session
 */
public class RedisSession {

    public final static Map<String,Map<String,Object>> SHARE_SESSION = new ConcurrentHashMap<>(512);

    public static Map<String,Object> getSession(String id){
        return SHARE_SESSION.get(id) ;
    }

    public static void putSession(String id,Map<String,Object> session){
        SHARE_SESSION.put(id,session);
    }

    public static void removeSession(String id ){
        SHARE_SESSION.remove(id) ;
    }

    public static boolean existsSession(String id){
        return Objects.nonNull(SHARE_SESSION.get(id)) ;
    }

}
